package com.ts.main.admin.controller;
import com.ts.main.admin.dto.MiniUserSearchPageDto;
import com.ts.main.admin.exception.R;
import com.ts.main.admin.exception.RPage;
import com.ts.main.admin.service.UserServiceImpl;
import com.ts.main.admin.vo.MiniUserVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author:lk
 * @Date: 2025/6/11  23:25
 */
@AllArgsConstructor
@RestController
@RequestMapping("/miniUser")
@Tag(name = "小程序管理-用户管理")
public class MiniUserController {

    private final UserServiceImpl userService;

    @PostMapping("/getMiniUserList")
    @Operation(summary = "查询小程序用户列表")
    public RPage<List<MiniUserVo>> getMiniUserPage(@RequestBody MiniUserSearchPageDto dto) {
        return userService.getMiniUserPage(dto);
    }

    @GetMapping("/getMiniUserDetails")
    @Operation(summary = "查询小程序用户详情")
    public R<MiniUserVo> getMiniUserDetails(@Schema(description = "小程序用户ID") @RequestParam Integer userId) {
        return R.ok(userService.getMiniUserDetails(userId));
    }

}